#ifndef _SINGLETHREADCMP_H
#define _SINGLETHREADCMP_H

#include <iostream>
#include <fstream>
#include <sstream>
#include <memory>
#include <cassert>
#include <string.h>
#include <stdlib.h>
#include <zlib.h>
#include <math.h>
#include <vector>


#include "../../engine/address.hpp"
#include "../../utils/libcache/cache_types.h"
#include "../../utils/libcache/CacheWriteBack.hpp"

#include "CMP.h"

#include "constants.h"
#include "memory.h"
#include "trace.h"

class SingleThreadCMP : public CMP {
    CacheWriteBack <address_t> *_cache;
    uint32_t _cacheSize;
    uint32_t *_cacheHits,  *_cacheMisses;
    uint32_t _tid,_region;

    void reset();


public:
    SingleThreadCMP(uint32_t threads, uint32_t lineSize,uint32_t pageSize,
                    uint32_t cacheSize);
    ~SingleThreadCMP();
     void executeCacheSimulation(Memory *mem,Trace *trace);

    inline uint32_t getCacheSize()              const { return _cacheSize; }
    inline uint32_t getThread()                 const { return _tid;}
    inline uint32_t getRegion()                 const { return _region;}
    inline void     setThread(uint32_t tid)           { _tid=tid;}
    inline uint32_t getCacheHits(int region)    const { return _cacheHits[region]; }
    inline uint32_t getCacheMisses(int region)  const { return _cacheMisses[region]; }
};

#endif
